package androidgame.framework.gl;

// Stores the texture coordinates of the top-left corner (u1, v1) and the bottom-right corner (u2, v2) of the region
// in texture coordinates. The constructor takes the top-left corner and the width and height of the region.
// x,y coordinates are with 0,0 in top left corner. When using a texture atlas made from a generator take care to take
// into account if a buffer pixel is used.
// @author dicarlo2

public class TextureRegion {    
    public final float u1, v1;
    public final float u2, v2;
    public final Texture texture;
    
    public TextureRegion(Texture texture, float x, float y, float width, float height) {
        this.u1 = x / texture.width;
        this.v1 = y / texture.height;
        this.u2 = this.u1 + width / texture.width;
        this.v2 = this.v1 + height / texture.height;        
        this.texture = texture;
    }
}
